package com.xiaoyezi.demo2.service.impl;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.xiaoyezi.demo2.DataSource.Shop;
import com.xiaoyezi.demo2.DataSource.User;
import com.xiaoyezi.demo2.mapper.UserMapper;
import com.xiaoyezi.demo2.service.IUserService;


@Service
public class UserService implements IUserService{
    // 注入UserMapper接口
    @Autowired
    UserMapper userMapper;

    // 更新用户
    @Override
    public void Update(User user){
        userMapper.Update(user);
    }
    // 根据zhanghao查询用户
    @Override
    public User getByZhanghao(User user) {
        User u = userMapper.getByZhanghao(user);
        System.out.println(u);
        return u;
    }

    // 根据ID查询用户
    @Override
    public User getById(User user){

        User u = userMapper.getById(user);
        return u;
    }

    // 查询所有用户
    @Override
    public List<User> selectList(){
        return userMapper.selectList();
    }
    
    // 创建用户
    @Override
    public void createUser(User user){
        userMapper.createUser(user);
    }
    // 登录用户
    @Override
    public User login(User user){

        return userMapper.login(user);
    }

}
